Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SatVu backend #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

c-wygoda
Copy link

New SatVu backend supporting SatVu's standard scene product (only one we have atm).

Notes

Needed to fix the missing values for type attribute of OpportunityFeature and OpportunityCollection. Not sure how that worked before but then again there's no dependency pinning... Also added basic logging setup because why not.

One thing to note about SatVu's opportunity/feasibility workflow: it's an async workflow which for the demo here is encapsulated sync flow of find_opportunities, which of course is not a good thing. A single request to STAT /opportunities will submit the feasibility request to SatVu's API and then poll SatVu's API until a final state is reached or a 60s timeout is reached.

Starting the API with SatVu support

SatVu's APIs all need a contract ID, which for us is part of the API base path. Since there's no access to the incoming request by the backend implementation to check for an header for example, for this demo, the service picks it from the env. 🙈

SATVU_CONTRACT_ID=74841d4e-60d4-4e73-a691-2dddffa10d92 LOG_LEVEL=DEBUG ./scripts/run backend

Submitting a request

Needs a auth token, which issumed to be in the TOKEN env var when in this example with HTTPie:


http \
    post \
    localhost:8000/opportunities \
    backend:satvu \
    Authorization:"Bearer ${TOKEN}" \
    geometry:='{"type": "Point", "coordinates": [12, 52]}' \
    product_id="standard-scene" datetime="2024-01-20T00:00:00/2024-02-29T00:00:00"

yields after roundabout 15s:

{
    "bbox": null,
    "features": [
        {
            "bbox": null,
            "geometry": {
                "bbox": null,
                "coordinates": [
                    12.0,
                    52.0
                ],
                "type": "Point"
            },
            "id": "0460039a-97f7-4233-979c-4fb144a4b9c7",
            "properties": {
                "constraints": null,
                "datetime": "2024-01-20T00:00:00/2024-02-29T00:00:00",
                "product_id": "standard-scene"
            },
            "type": "Feature"
        }
    ],
    "type": "FeatureCollection"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant